package com.piggy.system.api.factory;

import com.piggy.common.core.web.domain.AjaxResult;
import com.piggy.system.api.RemoteISysDictTypeService;
import com.piggy.system.api.RemoteISysSmsService;
import com.piggy.system.api.RemoteLogService;
import com.piggy.common.core.domain.R;
import com.piggy.system.api.domain.SysDictData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteISysDictTypeFactory implements FallbackFactory<RemoteISysDictTypeService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteFlowFallbackFactory.class);

    @Override
    public RemoteISysDictTypeService create(Throwable cause) {
        log.error("字典服务调用失败:{}", cause.getMessage());
        return new RemoteISysDictTypeService(){

            @Override
            public R<List<SysDictData>> selectDictDataByType(String dictType, String source) {
                log.error("字典服务调用失败:{}", cause.getMessage());
                return null;
            }

        };
    }
}
